<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>show.html</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        $(document).ready(function() {
            $.ajax({
                url: "/someServletThatReadsOutput", // 修改为返回数据的 Servlet URL
                method: "GET",
                dataType: "text", // 改为 text，因为返回的是纯文本
                success: function(data) {
                    // 假设您想在页面上显示这些数据
                    $("#output").text(data);
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    alert('请求失败: ' + textStatus + ' - ' + errorThrown);
                }
            });
        });
        function back() {
            window.location.href = "index.html";
        }
    </script>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f4f8;
            margin: 0;
            padding: 20px;
        }
        #output {
            border: 1px solid #55aaff;
            background-color: #ffffff;
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            white-space: pre-wrap; /* Allow line breaks */
            overflow-wrap: break-word; /* Handle long words */
            max-height: 300px;
            overflow-y: auto; /* Enable scrolling */
        }
        button {
            background-color: #55aaff;
            color: white;
            border: none;
            border-radius: 5px;
            padding: 10px 15px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s ease;
        }
        button:hover {
            background-color: #0099cc;
        }
    </style>
</head>
<body>
    <h3>数据展示</h3> <!-- 添加标题 -->
    <pre id="output"></pre> <!-- 用于显示 AJAX 请求返回的数据 -->
    <button id="back" onclick="back()">返回</button>
</body>
</html>